<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Notifications\Notifiable;

class InventoryRecord extends Model
{
    protected $fillable=['iid','admin_uid','bid','operation','number'];
    protected $table='inventory_records';
    protected $primaryKey = 'iid';

    public static function purchaseBook($admin_uid,$bid,$total_num){
        $inventory = self::create([
           'admin_uid' => $admin_uid,
            'bid' => $bid,
            'operation' => 0,
            'number' => $total_num,
        ]);
        return $inventory;
    }

    public static function deleteBooks($admin_uid,$bid,$number){
        $delete = self::create([
           'admin_uid' => $admin_uid,
           'bid' => $bid,
           'operation' => 1,
           'number' => $number,
        ]);

        return $delete;
    }


}